/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.itcast.controller;

import com.itcast.pojo.User;
import com.itcast.service.UserService;
import com.itcast.service.UserServiceImpl;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author linnanxiang
 */
@WebServlet("/UpdateUserInfoServlet")
public class UpdateUserInfoServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");
        UserService userService = new UserServiceImpl();
//        String head=req.getParameter("head");
        HttpSession session = req.getSession();
        String gender = req.getParameter("gender");
        String email = req.getParameter("email");
        String city = req.getParameter("city");
        String phone = req.getParameter("phone");
        String name = req.getParameter("name");
        User user = new User(name, email, city, phone, gender);
//        session.setAttribute("userInfo", user);
        userService.UpdateUser(user);
        req.getRequestDispatcher("/StoreUserServlet").forward(req, resp);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    }

}
